﻿@{
    var plugName = @admin.cyt369.com.Models.PlugName.Name;
    var tableName = PageViewModel.PageTableID(this, plugName);
    var menu_operation_list_id = PageViewModel.ControlID(this, "menu_operation_list", plugName);
    var menu_operation_list_fmt = PageViewModel.ControlID(this, "menu_operation_list_fmt", plugName);
    var menu_operation_list_tools = PageViewModel.ControlID(this, "menu_operation_list_tools", plugName);
    var menu_operation_list_tools_add = PageViewModel.PageFunctionNameArgs(this, "menu_operation_list_tools_add", plugName);
    var menu_operation_list_tools_add_dlg = PageViewModel.ControlID(this, "menu_operation_list_tools_add_dlg", plugName);
}
<script type="text/javascript">
    function @menu_operation_list_fmt (v,r,i) {
        var op = GetObject(r.OperationID, '~/Systems/GetAppOperationByID');
        if (op != null) {
            var str = "<div style='display:flex;justify-content: space-between;padding-left:10px;padding-right:10px'><span>";
            str += op.Name;
            str += "</span>";
            str += ("<span style='font-size:12px'>" + op.Code + "</span>");
            str += "</div>";

            return str;
        }
    }

    function @menu_operation_list_tools_add {
        var menu = $("#@tableName").treegrid("getSelected");
        if (menu != null) {
            var dlg = $dlg('@menu_operation_list_tools_add_dlg');
            dlg.dialog({
                title: '功能权限设置', width: 600, height: 400, closed: false, cache: false, modal: true, maximizable: false, resizable: false, maximized: false,
                href: '~/Systems/_EditAppMenuOperation?MenuID='+menu.Id+'&OPListID=@menu_operation_list_id',
                onResize: function () { $(this).dialog('center'); },
                buttons: [
                    {
                        text: "　关　闭　",
                        handler: function () { $("#@menu_operation_list_tools_add_dlg").dialog("close"); },
                    }
                ]
            });
        } else {
            $.messager.alert('提示', '请先选择功能菜单', 'info');
        }
    }
</script>
<div class="easyui-tabs" data-options="justified:false,border:false" style="width:100%" fit="true">
    <div title="功能权限" data-options="tools:'#@menu_operation_list_tools'">
        <ul id="@menu_operation_list_id" class="easyui-datalist" fit="true" data-options="border:false,lines:true,rownumbers:true,method:'get',onBeforeSelect: function(){return false;},
                                                                      textField:'Name',valueField:'Id',selectOnCheck:false,
                                                                      textFormatter:@menu_operation_list_fmt"></ul>
    </div>
</div>

<div id="@menu_operation_list_tools">
    <a href="javascript:void(0)" class="icon-mini-add" onclick="@menu_operation_list_tools_add" title="功能权限设置"></a>
</div>

